package com.example.yt_app.adapter;

import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import com.example.yt_app.Fragment.NewsFragment;

import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author dell
 * @date 2021/7/20
 */

@SuppressWarnings("ALL")
public class Equipment extends FragmentPagerAdapter {

    private ArrayList<Fragment> mFragments;
    //导航的标题
    @SuppressWarnings("AlibabaCommentsMustBeJavadocFormat")
    private List<String> mTitle;
    public Equipment(FragmentManager fm, ArrayList<Fragment> mFragments, List<String> title) {
        super(fm);
        mTitle=title;
        this.mFragments = mFragments;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public int getCount() {
        return mFragments.size();
    }

    /**
     * 这里设置对应于XTabLayout的标签名。
     *
     * @param position
     * @return
     */
    @Override
    public CharSequence getPageTitle(int position) {
        return mTitle.get(position);
    }

}